package com.ruoyi.quartz.task;


import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * @author TT
 * @date 2025/4/8 3:03
 * @description 爬虫任务类
 */
@Component("crawlerTask")
public class CrawlerTask {
    private static final String CRAWLER_API_URL = "https://baike.baidu.com/starmap/api/gethumanrelationcard?lemmaId=10201840&lemmaTitle=%E9%9E%A0%E5%A9%A7%E7%A5%8E";
    // 综艺信息API
    private static final String GET_ZY_API_URL = "http://127.0.0.1:5000/scrape";
    public void executeCrawler() {
        RestTemplate restTemplate = new RestTemplate();
        String response = restTemplate.getForObject(CRAWLER_API_URL, String.class);
        System.out.println("爬虫API调用结果：" + response);
    }
    /**
     * 获取综艺API
     */
    public void executeGetZy() {
        RestTemplate restTemplate = new RestTemplate();
        String response = restTemplate.getForObject(GET_ZY_API_URL, String.class);
        System.out.println("综艺API调用结果：" + response);
    }
}
